<?php
include "class/goods.class.php";
include "class/cart.class.php";
include "class/ui.class.php";
include "class/user.class.php";

session_start();

$goods = new Goods("cart", "root", "1234");
$cart = new Cart();
$ui = new UI();
$user = new User("JasonHu", "1234",9999);

$_SESSION['cart'] = $cart;
$_SESSION['ui'] = $ui;

$goods_data = $goods->getData();
$cart_data = $cart->calcData($goods_data);

$_SESSION['goods_data'] = $goods_data;

$ui->showUser($user->getName(), $user->getMoney());
$ui->showGoods($goods_data);
$ui->showCart($cart_data);
$ui->addLink('cart/pay.php', "立即下单");
$ui->addLinkNextLine('cart/clear.php', "清空购物车");